package com.codingapi.mybatisdemo2.controller;


import com.codingapi.mybatisdemo2.client.TestClient;
import com.codingapi.mybatisdemo2.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.codingapi.mybatisdemo2.entity.Test;
/**
 * Created by lorne on 2017/6/26.
 */
@Controller
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private DemoService demoService;




    @RequestMapping("/save")
    @ResponseBody
   public int save(){
        Test test=new Test();
        test.setId(1);
        test.setName("n");
        demoService.save(test);
        return 1;

    }

    @RequestMapping("/")
    public String index() {
        return"index";
    }
}
